package com.yb.core.util;


import cn.hutool.core.io.file.FileReader;

import java.io.IOException;
import java.io.InputStream;

public class YbFileReader {
    public static String readAsString(String filename){
        FileReader fileReader = new FileReader(filename);
        return fileReader.readString();
    }


    public static String readAsString(InputStream is){
        try {
            byte[] bs=new byte[is.available()];
            StringBuilder sb=new StringBuilder();
            int len=-1;
            while((len=is.read(bs,0,bs.length))>0){
                sb.append(new String(bs,0,len));
            }
            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


    public static void main(String[] args) {

    }
}
